/* 全局变量 */
:root {
    /* 深色主题配色 */
    --primary-dark: #1a1a2e;
    --secondary-dark: #16213e;
    --accent-blue: #00d4ff;
    --accent-red: #ff6b6b;
    --accent-green: #51cf66;
    --accent-purple: #9775fa;
    --accent-orange: #ff922b;

    /* 中性色 */
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #808080;
    --surface-primary: #2c2c54;
    --surface-secondary: #40407a;
    --surface-glass: rgba(255, 255, 255, 0.1);

    /* 阴影 */
    --shadow-neumorphic: 8px 8px 16px rgba(0, 0, 0, 0.3), -8px -8px 16px rgba(255, 255, 255, 0.05);
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.2);

    /* 渐变 */
    --gradient-primary: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary-dark) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--gradient-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* 背景动画 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(151, 117, 250, 0.1) 0%, transparent 50%);
    animation: backgroundShift 20s ease-in-out infinite;
    z-index: -1;
}

@keyframes backgroundShift {

    0%,
    100% {
        transform: translateX(0) translateY(0);
    }

    33% {
        transform: translateX(-20px) translateY(-10px);
    }

    66% {
        transform: translateX(20px) translateY(10px);
    }
}

#app {
    height: 100vh;
    position: relative;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* 新拟态按钮 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-accent);
    color: white;
    box-shadow: var(--shadow-neumorphic);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.3);
}

.btn-secondary {
    background: var(--surface-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-neumorphic);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    background: var(--surface-secondary);
}

/* 玻璃拟态输入框 */
.input {
    padding: 16px 20px;
    border: none;
    border-radius: 16px;
    font-size: 14px;
    width: 100%;
    background: var(--surface-glass);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.input::placeholder {
    color: var(--text-muted);
}

.input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
    background: rgba(255, 255, 255, 0.15);
}

/* 玻璃拟态卡片 */
.card {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: var(--shadow-glass);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* 搜索容器 */
.search-container {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    align-items: center;
}

/* 角色网格 */
.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    padding: 20px 0;
}

/* 角色卡片 - 新拟态设计 */
.role-card {
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow-neumorphic);
    padding: 24px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    min-height: 200px;
}

.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-accent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.role-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow:
        12px 12px 24px rgba(0, 0, 0, 0.4),
        -12px -12px 24px rgba(255, 255, 255, 0.1);
}

.role-card:hover::before {
    transform: scaleX(1);
}

/* 角色卡片激活状态 */
.role-card.active {
    border-color: var(--accent-blue);
    box-shadow:
        0 0 0 2px rgba(0, 212, 255, 0.3),
        var(--shadow-neumorphic);
}

/* 角色卡片内容 */
.role-card h3 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 20px;
    font-weight: 700;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.role-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 14px;
    margin-bottom: 16px;
}

/* 聊天容器 - 沉浸式设计 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--gradient-primary);
    position: relative;
    overflow: hidden;
}

.chat-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 30% 20%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(255, 107, 107, 0.1) 0%, transparent 50%);
    z-index: 0;
}

/* 聊天头部 - 玻璃拟态 */
.chat-header {
    padding: 20px 24px;
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: transparent;
    position: relative;
    z-index: 1;
}

/* 消息气泡 */
.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message-content {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 20px;
    word-wrap: break-word;
    position: relative;
    backdrop-filter: blur(10px);
}

.message.ai .message-content {
    background: var(--surface-glass);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 6px;
    color: var(--text-primary);
    box-shadow: var(--shadow-soft);
}

.message.user .message-content {
    background: var(--gradient-accent);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 212, 255, 0.3);
}

/* 消息头像 */
.message-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 16px;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
}

.message:hover .message-avatar {
    transform: scale(1.1);
}

.message.ai .message-avatar {
    background: var(--gradient-accent);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
}

/* 聊天输入区域 */
.chat-input {
    padding: 20px 24px;
    background: var(--surface-glass);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 1;
}

.input-container {
    display: flex;
    gap: 16px;
    align-items: center;
}

.input-container input {
    flex: 1;
    background: var(--surface-glass);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 16px 20px;
    border-radius: 16px;
    font-size: 15px;
}

.input-container input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2);
}

.input-container button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-style: italic;
    padding: 12px 16px;
    background: var(--surface-glass);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--surface-glass);
    border-top: 2px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 返回按钮 */
.back-btn {
    background: var(--surface-glass);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: 16px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-weight: 600;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

/* 打字机效果 - 光标闪烁 */
.message.ai .message-content {
    position: relative;
}

.message.ai .message-content::after {
    content: '|';
    animation: blink 1s infinite;
    color: #007bff;
    font-weight: bold;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* 当消息完成时隐藏光标 */
.message.ai .message-content.completed::after {
    display: none;
}